package api

import (
	"github.com/gin-gonic/gin"
	"runtime"
)

type HomeController struct {
}

func (con HomeController) Info(ctx *gin.Context) {
	cpuNum := runtime.NumCPU()
	goroutineNum := runtime.NumGoroutine()
	ctx.JSON(200, gin.H{
		"code": 0,
		"msg":  "success",
		"data": map[string]interface{}{
			"cpuNum":       cpuNum,
			"goroutineNum": goroutineNum,
		},
	})
}

func (con HomeController) Test(ctx *gin.Context) {
	//value := ctx.Query("value")
	//taskID, _ := strconv.Atoi(value)
	//if taskID == 0 {
	//	ctx.JSON(200, gin.H{
	//		"code": 2,
	//		"msg":  "无效的参数 value, value 值即为 task_id",
	//	})
	//	return
	//}
	ctx.JSON(200, gin.H{
		"code": 0,
		"msg":  "success",
		"data": map[string]interface{}{},
	})
}
